<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of ManagerGroup
 *
 * @author Administrator
 */
class ManagerGroup extends CActiveRecord{
    public function rules() {
        return array(
            array('admin_group_name', 'required'),
            array('admin_group_name', 'length', 'max' => 30)
        );
    }

    public function attributeLabels() {
        return array(
            'admin_group_id' => Yii::t('default', '管理组编号'),
            'admin_group_name' => Yii::t('default', '管理组名称')
        );
    }

    /**
     * Returns the static model of the specified AR class.
     * @return CActiveRecord the static model class
     */
    public static function model($className=__CLASS__) {
        return parent::model($className);
    }

    /**
     * @return string the associated database table name
     */
    public function tableName() {
        return '{{admin_group}}';
    }
    public function getParentOption() {
        $list = $this->findAll("", array("order" => "admin_group_id ASC"));
        $result = array();
        
        $result[""] = Yii::t('default', '选择一个权限组');
        foreach ($list as $row) {
            $result[$row['admin_group_id']] = $row['admin_group_name'];
        }
        unset($list);
        return $result;
    }
}

?>
